 //
//  StrategyTest.m
//  Charles
//
//  Created by Charles on 2017/6/13.
//  Copyright © 2017年 charles. All rights reserved.
//

#import "StrategyTest.h"
#import "Duck.h"
#import "Behavior.h"

@implementation StrategyTest

+ (void)test {
    Duck *mallardDuck = [[MallardDuck alloc]init];
    [mallardDuck performQuack];
    [mallardDuck performFly];
    
    Duck *model = [[ModelDuck alloc]init];
    [model performFly];
    
    //设置对象的行为
    FlyRocketPowered *flyBehavior = [[FlyRocketPowered alloc]init];
    [model setFlyBehavior:flyBehavior];
    [model performFly];
    
    FlyNoWay *nowayBehavior = [[FlyNoWay alloc]init];
    [model setFlyBehavior:nowayBehavior];
    [model performFly];

}

@end
